package com.yuanrui.practice.server.enums;

import lombok.Getter;

@Getter
public enum CompleteStatusEnum {

    /**
     * 未完成
     */
    UNFINISHED(0, "未完成"),
    /**
     * 已完成
     */
    FINISHED(1, "已完成");

    private final Integer code;

    private final String desc;

    CompleteStatusEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static CompleteStatusEnum getByCode(Integer code) {
        for (CompleteStatusEnum value : values()) {
            if (value.code.equals(code)) {
                return value;
            }
        }
        return null;
    }
}
